<%--
  Created by IntelliJ IDEA.
  User: colin
  Date: 2017/5/7
  Time: 16:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/header.jsp" %>
<html>
<head>
    <title>订单列表</title>
    <link rel="stylesheet" href="${Layui}/css/layui.css" media="all">
    <script src="${jquery}/jquery-3.1.1.js" charset="utf-8"></script>
    <script src="${Layui}/layui.js" charset="utf-8"></script>
    <script src="${Js}/admin/purchase.js" charset="utf-8"></script>
</head>
<body style="margin-left:2px">
<input type="text" value="${pageIndex}" hidden id="pageIndex">
<input type="text" value="${pageCount}" hidden id="pageCount">
<input type="text" value="${condition}" hidden id="condition">
<div class="layui-tab layui-tab-brief">
    <div class="layui-tab-content">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend style="font-size: 14px;">
                <form class="layui-form" method="post" action="search" name="search">
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input name="purchase.id" id="pid" lay-verify="" autocomplete="off" value=""
                                   placeholder="请输入订单编号" class="layui-input" type="text">
                        </div>
                        <div class="layui-input-inline">
                            <input name="customerName" id="customerName" lay-verify="" autocomplete="off"
                                   value="${customerName}"
                                   placeholder="客户名" class="layui-input" type="text">
                        </div>
                        <div class="layui-input-inline">
                            <select name="purchase.orderType" id="orderType">
                                <c:if test="${condition['orderType'] == null}">
                                    <option value="">订单类型</option>
                                </c:if>
                                <c:forEach items="${SysDict['order_type']}" var="type">
                                    <c:if test="${condition['orderType'] == type.key}">
                                        <option value="${type.key}" selected>${type.value}</option>
                                    </c:if>
                                    <c:if test="${condition['orderType'] != type.key}">
                                        <option value="${type.key}">${type.value}</option>
                                    </c:if>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <select name="purchase.orderStatus" id="orderStatus">
                                <c:if test="${condition['orderStatus'] == null}">
                                    <option value="">订单状态</option>
                                </c:if>

                                <c:forEach items="${SysDict['order_status']}" var="status">
                                    <c:if test="${condition['orderStatus'] == status.key}">
                                        <option value="${status.key}" selected>${status.value}</option>
                                    </c:if>
                                    <c:if test="${condition['orderStatus'] != status.key}">
                                        <option value="${status.key}">${status.value}</option>
                                    </c:if>
                                </c:forEach>
                            </select>
                        </div>
                        <input type="submit" id="search" class="layui-btn layui-btn-normal btn-search" value="搜索">
                    </div>
                </form>
            </legend>
        </fieldset>

        <div class="layui-form">
            <table class="layui-table">
                <colgroup>
                    <col width="50">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                    <col width="200">
                    <col width="150">
                    <col width="150">
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th><input name="" lay-skin="primary" lay-filter="allChoose" type="checkbox"></th>
                    <th>订单号</th>
                    <th>顾客姓名</th>
                    <th>总价</th>
                    <th>下单时间</th>
                    <th>订单类型</th>
                    <th>订单状态</th>
                    <th>订单备注</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${lists}" var="purchase">
                    <tr>
                        <td><input name="" lay-skin="primary" type="checkbox" value="${purchase.id}"></td>
                        <td>${purchase.id}</td>
                        <td>${purchase.croCustomer.username}</td>
                        <td>${purchase.totalprice}</td>
                        <td>${purchase.orderdate}</td>
                            <%--使用缓存中的SysDic进行标识状态--%>
                        <td>${SysDict['order_type'][purchase.orderType]}</td>
                        <td>${SysDict['order_status'][purchase.orderStatus]}</td>
                        <td>${purchase.notes}</td>
                        <td>
                            <div class="layui-btn-group">
                                <a class="layui-btn layui-btn-primary layui-btn-small edit" data-method="detail"
                                   pid="${purchase.id}">
                                    <i class="layui-icon">&#xe642;</i>
                                </a>
                                <%--<a class="layui-btn layui-btn-primary layui-btn-small done" data-method="done"--%>
                                   <%--ostatus="${purchase.orderStatus}" pid="${purchase.id}">--%>
                                    <%--<i class="layui-icon">&#xe616;</i>--%>
                                <%--</a>--%>
                                <a class="layui-btn layui-btn-primary layui-btn-small delete" data-method="delete"
                                   pid="${purchase.id}">
                                    <i class="layui-icon">&#xe640;</i>
                                </a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
        <div id="fullpage"></div>
    </div>
</div>

<%--<div id="tmpStatus" class="hidden" hidden>--%>
    <%--<div class="layui-form">--%>
        <%--<div class="layui-form-item">--%>
            <%--<div class="layui-input-block">--%>
                <%--<select name="purchase.orderStatus">--%>
                    <%--<option value="">订单状态</option>--%>
                    <%--<c:forEach items="${SysDict['order_status']}" var="status">--%>
                        <%--<option value="${status.key}">${status.value}</option>--%>
                    <%--</c:forEach>--%>
                <%--</select>--%>
            <%--</div>--%>
        <%--</div>--%>
    <%--</div>--%>
<%--</div>--%>
</body>
</html>
